package com.cxyzy.demo.property_anims

import android.content.Context
import android.graphics.Canvas
import android.graphics.Color
import android.graphics.Paint
import android.graphics.RectF
import android.util.AttributeSet
import android.view.View

class ArcView @JvmOverloads constructor(context: Context, attrs: AttributeSet? = null) : View(context, attrs) {

    private var mProgress = 0f
    private var blackPaint = Paint()

    init {
        blackPaint.color = Color.BLACK
    }

    // 创建 getter 方法
    fun getProgress(): Float {
        return mProgress
    }

    // 创建 setter 方法
    fun setProgress(progress: Float) {
        this.mProgress = progress
        invalidate()
    }

    public override fun onDraw(canvas: Canvas) {
        super.onDraw(canvas)
        val arcRectF = RectF(0f, 0f, 200f,200f)

        canvas.drawArc(arcRectF, 135f, mProgress * 2.7f, false, blackPaint)
    }
}